package com.agileai.bpm.domain.define;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class Process extends DefineObject{
	private Activity startActivity = null;
	
	private List<Activity> activityList = new ArrayList<Activity>();
	private List<Transition> transitionList = new ArrayList<Transition>();
	private List<ProcessVariable> variableList = new ArrayList<ProcessVariable>();
	private List<DatabaseResource> dbResourceList = new ArrayList<DatabaseResource>();
	
	private HashMap<String,Activity> activityContainer = new HashMap<String,Activity>();
	private String defineXML = null;
	private String graphJSON = null;
	private String status = null;
	private String version = null;
	private String createTime = null;
	private String createrId = null;
	private String modifier = null;
	private String modifyTime = null;
	private String group = null;
	
	public List<Activity> getActivityList() {
		return activityList;
	}
	public Activity getActivity(String activityCode){
		Activity result = new Activity();
		for (int i=0;i < activityList.size();i++){
			Activity curActivity = activityList.get(i);
			if (activityCode.equals(curActivity.getCode())){
				result = curActivity;
				break;
			}
		}
		return result;
	}
	public List<Transition> getTransitionList() {
		return transitionList;
	}

	public List<ProcessVariable> getVariableList() {
		return variableList;
	}

	public Activity getStartActivity() {
		return startActivity;
	}

	public void setStartActivity(Activity startActivity) {
		this.startActivity = startActivity;
	}
	
	public void storeActivity(Activity activity){
		this.activityContainer.put(activity.getCode(), activity);
		activity.setProcess(this);
	}
	public HashMap<String, Activity> getActivityContainer() {
		return activityContainer;
	}
	public String getDefineXML() {
		return defineXML;
	}
	public void setDefineXML(String defineXML) {
		this.defineXML = defineXML;
	}
	public String getGraphJSON() {
		return graphJSON;
	}
	public void setGraphJSON(String graphJSON) {
		this.graphJSON = graphJSON;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	public String getVersion() {
		return version;
	}
	public void setVersion(String version) {
		this.version = version;
	}
	public String getCreaterId() {
		return createrId;
	}
	public void setCreaterId(String createrId) {
		this.createrId = createrId;
	}
	public String getCreateTime() {
		return createTime;
	}
	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}
	public String getGroup() {
		return group;
	}
	public void setGroup(String group) {
		this.group = group;
	}
	public String getModifier() {
		return modifier;
	}
	public void setModifier(String modifier) {
		this.modifier = modifier;
	}
	public String getModifyTime() {
		return modifyTime;
	}
	public void setModifyTime(String modifyTime) {
		this.modifyTime = modifyTime;
	}
	public List<DatabaseResource> getDbResourceList() {
		return dbResourceList;
	}
}